package com.dlcb.csd.service.impl;

import com.dlcb.csd.mappper.UserMapper;
import com.dlcb.csd.po.User;
import com.dlcb.csd.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author:薛亮亮
 * @Date 2020/12/22 23:13
 * @Discription:
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;
    @Override
    public int insertUser(User user) {
        return userMapper.insertUser(user);
    }

    /**
     * 查询用户
     * @param tel
     * @return
     */
    @Override
    public User findUserByTel(String tel) {

        return userMapper.findUserByTel(tel);
    }

    @Override
    public List<User> findSysUser() {
        return userMapper.findSysUser();
    }

    @Override
    public boolean deleteUserById(int id) {
        try {
            userMapper.deleteUserByid(id);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return false;
    }

    @Override
    public User findUserById(int id) {
        return userMapper.findUserById(id);
    }


}
